package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppRiskMonitoring;
import com.ep.modules.app.service.AppRiskMonitoringService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/risk_monitoring")
public class AppRiskMonitoringController {
    @Autowired
    private AppRiskMonitoringService appRiskMonitoringService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appRiskMonitoringService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppRiskMonitoring appriskmonitoring = appRiskMonitoringService.getById(id);
        return R.ok().put("appriskmonitoring", appriskmonitoring);
    }

    @SysLog("保存AppRiskMonitoring")
    @PostMapping("/save")
    public R save(@RequestBody AppRiskMonitoring appriskmonitoring) {
        ValidatorUtils.validateEntity(appriskmonitoring);
        appRiskMonitoringService.save(appriskmonitoring);
        return R.ok();
    }

    @SysLog("修改AppRiskMonitoring")
    @PostMapping("/update")
    public R update(@RequestBody AppRiskMonitoring appriskmonitoring) {
        ValidatorUtils.validateEntity(appriskmonitoring);
        appRiskMonitoringService.update(appriskmonitoring);
        return R.ok();
    }

    @SysLog("删除AppRiskMonitoring")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appRiskMonitoringService.deleteBatch(ids);
        return R.ok();
    }
}